import upload from '@/utils/upload'
import request from '@/utils/request'


// 地圖相關
export function AllGEODETIC(data: any) {
    return request({
        url: '/mobile/product/geodetic',
        method: 'get',
        data: data
    })
}

// 查詢地圖分類
export function HKMAPgetCategory() {
    return request({
        url: '/mobile/product/category',
        method: 'get',
        data: { pageSize: 1000 }
    })
}

//搜索拨地
export function SEARCHLOTGAL(key: string) {
    return request({
        url: '/mobile/product/searchLot/' + key,
        method: 'get'
    })
}

export function AllLOTGAL(data: any) {
    return request({
        url: '/mobile/product/lotgla/' + data,
        method: 'get',
        data: { pageSize: 1000 }
    })
}

export function HKMAPlotglaByPid(data: any) {
    return request({
        url: '/mobile/product/lotglaPid/' + data,
        method: 'get',
        data: { pageSize: 1 }
    })
}

export function geodeticBounds(data: any) {
    return request({
        url: '/mobile/product/geodetic/bounds',
        method: 'get',
        data: data
    })
}


export function HKMAPsearchgeodetic(data: any) {
    return request({
        url: '/mobile/product/searchgeodetic/' + data,
        method: 'get',
        data: { pageSize: 1 }
    })
}



export function HKMAPgetLotType(data: any) {
    return request({
        url: '/mobile/product/lotType/' + data,
        method: 'get',
        data: { pageSize: 50 }
    })
}


// 香港地圖相關数据
// export function HKDATAQUERY(data: any) {
//     return request({
//         timeout: 100000,
//         baseUrl: 'https://api.csdi.gov.hk/apim/dataquery/api/',
//         method: 'get',
//         data: data
//     })
// }





export function QUERYSTATIONNO(data: any) {
    return request({
        timeout: 100000,
        url: '/mobile/product/list',
        method: 'get',
        data: data
    })
}

export function submitAMessage(data: any) {
    return request({
        url: '/mobile/product/message/add',
        method: 'post',
        data: data
    })
}

export function getMessageList(data?: any) {
    return request({
        url: '/mobile/product/message/list',
        method: 'get',
        data: data
    })
}


//查詢香港地圖數據-www.map.gov.hk
export function HKMAPautocomplete(data: any) {
    const parameter = {
        autocomplete: data
    }
    return request({
        url: '/gih-ws2/autocomplete',
        method: 'get',
        data: parameter
    })
}

//查詢香港地圖數據-www.map.gov.hk
export function HKMAPsearch(keyword: string) {
    const parameter = {
        keyword: keyword,
        extent: ""
    }

    return request({
        url: '/gih-ws2/search',
        method: 'get',
        data: parameter
    })
}

export function HKMAPaddressDetails(type: string, faciType: string, id: string) {
    let keyword = id
    if (faciType && faciType != "" && faciType != null) {
        keyword = faciType + "~" + keyword
    }
    return request({
        url: '/gih-ws2/address/' + type + '/' + keyword + '/WEB',
        method: 'get'
    })
}

//HK80坐标转换-www.geodetic.gov.hk
export function HKMAPtransform(e: any, n: any) {
    const parameter = {
        inSys: 'hkgrid',
        outSys: 'wgsgeog',
        e: e,
        n: n
    }
    return request({
        url: '/mobile/product/hktowgs',
        method: 'get',
        data: parameter
    })
}


